<template>
  <van-nav-bar :border="false">
    <template #left>
      <van-icon v-if="leftArrow" name="arrow-left" size="24px" @click="handleClickLeft" />
      <van-icon v-if="home" name="wap-home" size="24px" @click="handleClickHome" />
      <van-icon v-if="search" name="search" style="margin-left:16px" size="24px" @click="handleSearch" />
    </template>

    <template #title>
      <div class="title">
        {{ title }}
      </div>
    </template>
  </van-nav-bar>
</template>

<script>
export default {
  name: 'ZeNavBar',
  props: {
    leftArrow: {
      type: Boolean,
      default: false,
    },
    title: {
      type: String,
      default: '',
    },
    home: {
      type: Boolean,
      default: false,
    },
    search: {
      type: Boolean,
      default: false,
    },
  },
  methods: {
    handleClickLeft() {
      uni.navigateBack()
    },
    handleClickHome() {
      uni.reLaunch({ url: '/pages/index/index' })
    },
    handleSearch() {
      this.$emit('nav-search')
    },
  },
}
</script>

<style lang="scss" scoped>
.title {
  color: #000;
  font-size: 18px;
  font-weight: 500;
}
</style>
